'use strict';

module.exports = app => {
  const { ENUM, INTEGER } = app.Sequelize;
  // 商户收入日志
  const MerchantIncomeLog = app.model.define('merchantIncomeLog', {
    // 商户的收入
    merchantIncome: { type: INTEGER, allowNull: false },
    // 佣金发放状态
    status: {
      type: ENUM,
      values: [ 'pending', 'success' ],
      allowNull: false,
      defaultValue: 'pending',
    },
  });

  MerchantIncomeLog.associate = function() {
    // 店铺
    MerchantIncomeLog.belongsTo(app.model.Order);
    // 店铺
    MerchantIncomeLog.belongsTo(app.model.Store);
  };

  return MerchantIncomeLog;
};
